<?php

namespace App\Http\Controllers\Api\v1;

use App\common;
use App\Http\Controllers\Controller;
use App\Logic\LiveLogic;
use Illuminate\Http\Request;

class LiveController extends Controller
{
    //
    /**
     * 直播
     */
    public function live(Request $request)
    {
        try {
            if ($request->method() == 'GET') {
                $user_id = $request->get('user_id');
                $title = $request->get('title');
                $res = LiveLogic::live($user_id,$title);
                if ($res){
                    return common::success(200,$res,'推流链接获取成功');
                }
            }else{
                throw new \Exception('请求方式错误');
            }
        }catch (\Exception $exception){
            return common::fail('','',$exception->getMessage());
        }
    }
}
